package net.zbus.pubsub;

import net.zbus.BusClient;
import net.zbus.ClientPool;
import net.zbus.ClientPoolConfig;
import net.zbus.ZMsg;


public class Publisher {
 
	public static void main(String[] args) { 
		ClientPoolConfig config = new ClientPoolConfig();
		config.setHost("10.60.60.13"); 
		config.setPort(15555);

		ClientPool pool = new ClientPool(config);
		
		
		ZMsg message = new ZMsg();
		message.pushBack("PubSub Message@"+System.currentTimeMillis());
		message.pushBack(new byte[10]);    
		message.pushBack("from JAVA");     
		
		BusClient client = pool.borrowClient();
		
		boolean status = client.publish("APEX_PUB", "", "topic1", message, 2500);
		
		System.out.println("Publish Status: " + status); 
		
		pool.returnClient(client);
		pool.destroy();
	}

}
